//跳转到顶部
$("#to_top").click(function () {
    $('body,html').animate({scrollTop:0},500);
    return false;
});

$('.h2').mouseenter(function () {
    $('.ewm').addClass('ewm1');
}).mouseleave(function () {
    $('.ewm').removeClass('ewm1');
})

//banner
var swiper_banner = new Swiper('.swiper-container-1', {
    autoplay: true,
    speed: 800,
    pagination: {
        el: '.swiper-pagination-1',
        clickable:true
    }
});

//advantage
var swiper_advantage = new Swiper('.swiper-container-adv', {
    autoplay: true,
    pagination: {
        el: '.swiper-pagination-adv',
        clickable:true
    },
    navigation: {
        nextEl: '.swiper-button-next-adv',
        prevEl: '.swiper-button-prev-adv'
    }
});

//news
var swiper_news = new Swiper('.swiper-container-news', {
    loop:true,
    autoplay: true,
    navigation: {
        nextEl: '.swiper-button-next-adv',
        prevEl: '.swiper-button-prev-adv'
    },
    pagination: {
        el: '.swiper-pagination-adv',
        clickable: true
    }
});

//franchise
var swiper_franchise = new Swiper('.swiper-container-franchise', {
    direction: 'vertical',
    slidesPerView: 4,
    autoplay: true,
    speed:800
});

//report
var swiper_report = new Swiper('.swiper-container-report', {
    direction: 'vertical',
    slidesPerView: 8,
    slidesPerGroup:8,
    autoplay: true
});

// identification
var identification = new Swiper('.swiper-container_optimal', {
    slidesPerView: 6,
    slidesPerColumn: 2,
    spaceBetween: 15,
    slidesPerGroup: 8,
    speed:800,
    autoplay: true
});

//customer
var swiper_customer = new Swiper('.swiper-container-customer', {
    direction: 'vertical',
    autoplay: true,
    slidesPerView: 2,
    slidesPerColumn: 6,
    spaceBetween: 8,
    navigation: {
        nextEl: '.swiper-button-next-c0',
        prevEl: '.swiper-button-prev-c0'
    }
});

var s6_swiper = new Swiper('.s6_swiper',{
    speed:500,
    slidesPerView:11,
    navigation: {
        nextEl: '.swiper-s6-next',
        prevEl: '.swiper-s6-prev'
    }
});

//jiameng
var jiameng = new Swiper('.swiper-container-jiameng', {
    direction: 'vertical',
    autoplay: true,
    slidesPerView: 8,
    speed:800
});

//hot
var hot = new Swiper('.swiper-container-hot', {
    slidesPerView: 4,
    slidesPerColumn: 3,
    slidesPerGroup: 4,
    speed:800,
    pagination: {
        el: '.swiper-pagination-hot',
        clickable: true
    }
});

//client_list
var client = new Swiper('.swiper-container-client', {
    direction: 'vertical',
    autoplay: true,
    slidesPerView: 2,
    slidesPerColumn: 6,
    spaceBetween: 5,
    navigation: {
        nextEl: '.swiper-button-next0',
        prevEl: '.swiper-button-prev0'
    }
});

//显示对应栏目内容介绍
$(".news_tab li").eq(0).show();
$(".news_tab li").each(function (i) {
    $(this).mouseover(function () {
        $(this).addClass('pink').siblings().removeClass('pink');
        $(".content9 > div").eq(i).show().siblings().hide();
    })
}).eq(0).mouseover();

$(".jm_title > span").eq(0).show();
$(".jm_title > span").each(function (i) {
    $(this).mouseover(function () {
        $(this).addClass('selected').siblings().removeClass('selected');
        $(".jm_con > form").eq(i).show().siblings().hide();
    })
}).eq(0).mouseover();

$(".concern_title > p").eq(0).show();
$(".concern_title > p").each(function (i) {
    $(this).mouseover(function () {
        $(this).addClass('selected_title').siblings().removeClass('selected_title');
        $(".l3_con > .concern_content").eq(i).show().siblings().hide();
    })
}).eq(0).mouseover();


//滚动
$(function(){
    $('.dowebok').liMarquee({
        direction: 'up',
        scrollamount: 40,
        runshort: false,
        drag: false
    });
    $('.dowebok1').liMarquee({
        drag: false
    });
    $('.dowebok2').liMarquee({
        direction: 'up',
        scrollamount: 20,
        runshort: false,
        drag: false
    });
});

//关闭左侧悬浮
function closeLeft(){
    $('.jc-bm-left').css('display','none');
}

//关闭右侧悬浮
function closeRight(){
    $('.jc-bm-right').css('display','none');
}

function qr(type) {
    layui.use('layer', function(){
        var layer = layui.layer;
        layer.open({
            type: 1,
            content: $('#cy-qr')
        });
    });
    if(type == 1){
        $('#join_text').text('申请加入VIP');
    }else{
        $('#join_text').text('我要招商');
    }
}

$("#fu .close_bm_btn").on('click',function(){
    $("html").removeClass('pb0');
    $("#fu .jc-bm-bottom").animate({left:"+=100%"});
    $("#fu .close_bm_btn").css("display",'none');
    $("#fu .close_bm_btn1").css("display",'block');
})

$("#fu .close_bm_btn1").on('click',function(){
    $("html").addClass('pb0');
    $("#fu .jc-bm-bottom").animate({left:"-=100%"});
    $("#fu .close_bm_btn1").css("display",'none');
    $("#fu .close_bm_btn").css("display",'block');
})

$(".inner_news_type > p").eq(0).show();
$(".inner_news_type > p").each(function (i) {
    $(this).click(function () {
        $(this).addClass('selected').siblings().removeClass('selected');
        $(".news_wrapper > .company_news").eq(i).show().siblings().hide();
    })
}).eq(0).click();

//弹出层,判断无数据
function no_data1() {
    layui.use('layer', function(){
        var layer = layui.layer;
        layer.alert("已到第一条");
    });
}
function no_data2() {
    layui.use('layer', function(){
        var layer = layui.layer;
        layer.alert("已到最后一条");
    });
}

$(window).load(function () {
    //上下条,上下页
    // if($(".prev_next").length>0){
    //     var str1="<span class='layui-icon layui-icon-left'></span>";
    //     var str2="<span class='layui-icon layui-icon-right'></span>";
    //     $(str1).prependTo(".prev_next li:eq(0)");
    //     $(str2).appendTo(".prev_next li:eq(1)");
    // }
    //打字机
    new TypeIt('.no_data', {
        speed: 140,
        autoStart: false
    });
    new TypeIt('.needTypeIt', {
        speed: 150,
        autoStart: false
    });
});

var galleryThumbs = new Swiper('.gallery-thumbs', {
    spaceBetween: 10,
    slidesPerView: 4,
    freeMode: true,
    watchSlidesVisibility: true,
    watchSlidesProgress: true,
});
var galleryTop = new Swiper('.gallery-top', {
    spaceBetween: 10,
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
    thumbs: {
        swiper: galleryThumbs
    }
});

//文字样式
var $cta = $('.cta');
var createBtnsMarkup = function createBtnsMarkup() {
    $cta.each(function (i, btn) {
        var $t = $(btn);
        var $btnText = $t.text();
        var $splitText = $btnText.split("");

        $t.html("").append("\n\t\t\t\t<span class=\"btn-text-parent\">\n\t\t\t\t\t<span class=\"wrap_text current-btn-text\"></span>\n\t\t\t\t\t<span class=\"wrap_text buildin-btn-text\"></span>\n\t\t\t\t</span>\n\t\t\t");
        for (var _i = 0; _i < $splitText.length; _i++) {
            $t.
            find(".wrap_text").
            append("<span class=\"btn-letter\">" + $splitText[_i] + "</span>");
        }
    });
};
window.onLoad = createBtnsMarkup();